MyMenuItemDrawingProc
NEW WITH THE APPEARANCE MANAGER
Draws a custom menu item that coordinates with the current theme.The Appearance Manager declares the type for an application-defined menu item drawing function as follows:
typedef pascal void (*MenuItemDrawingProcPtr)(const Rect *inBounds, SInt16 inDepth, Boolean inIsColorDevice, SInt32 inUserData);The Appearance Manager defines the data typeMenuItemDrawingUPP
to identify the universal procedure pointer for an application-defined menu item drawing function:
typedef UniversalProcPtr MenuItemDrawingUPP;You typically use theNewMenuItemDrawingProc
macro like this:
MenuItemDrawingUPP
myMenuItemDrawing
UPP;
myMenuItemDrawing
UPP = NewMenuItemDrawing
Proc(MyMenuItemDrawingProc
);You typically use the
CallMenuItemDrawingProc
macro like this:CallMenuItemDrawingProc(my
MenuItemDrawing
UPP, inBounds, inDepth, inIsColorDevice, inUserData);Here's how to declare a custom menu item drawing function, if you were to name the function
MyMenuItemDrawingProc
:
pascal void (MyMenuItemDrawingProc) (const Rect *inBounds, SInt16 inDepth, Boolean inIsColorDevice, SInt32 inUserData);
inBounds
- On input, a pointer to a rectangle in which you should draw your menu item content.
inDepth
- The bit depth (in pixels) of the current graphics port.
inIsColorDevice
- A Boolean value. Set to
true
to indicate that you are drawing on a color device. Set tofalse
for a monochrome device.inUserData
- User data specifying how to draw the menu item content, passed in from the
inUserData
parameter ofDrawThemeMenuItem
.DISCUSSION
Your menu item drawing function will be called clipped to the rectangle in which you are allowed to draw your content; do not draw outside this region. You should center your content vertically inside the content rectangle.At the time your menu item drawing function is called, the foreground text color and mode is already set to draw in the specified state (enabled, selected, disabled) and correct color for the theme. You do not need to set the color unless you have special drawing needs.
- IMPORTANT
- You should not depend on the background color for your menu item, so you should not call the
EraseRect
function from your menu item drawing function.![]()
SPECIAL CONSIDERATIONS
Make sure Appearance Manager 1.0.1 is present before calling yourMyMenuItemDrawingProc
function. See "Appearance Manager Gestalt Selector Constants" for details on how to determine if the Appearance Manager is present and what its version is, if so.